home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / man / lib.fmt / c / bsearch.man < prev    next >
Encoding:
Text File  |  1989-06-29  |  1.5 KB  |  69 lines

  1.  
  2.  
  3.  
  4. bsearch               C Library Procedures                bsearch
  5.  
  6.  
  7.  
  8. _________________________________________________________________
  9.  
  10. NNAAMMEE
  11.      bsearch - Binary search
  12.  
  13. SSYYNNOOPPSSIISS
  14.      vvooiidd **bbsseeaarrcchh((kkeeyy,, bbaassee,, nn,, ssiizzee,, ccmmpp))
  15.  
  16. AARRGGUUMMEENNTTSS
  17.      void *_k_e_y;                Pointer  to   the   object   being
  18.                                searched for.
  19.  
  20.      void *_b_a_s_e;               Pointer to the base of  the  array
  21.                                to search.
  22.  
  23.      size_t    _n;              Number of items in the array.
  24.  
  25.      size_t    _s_i_z_e;           Size of each item.
  26.  
  27.      int  (*_c_m_p)();            Function to compare two items.
  28.  
  29. _________________________________________________________________
  30.  
  31.  
  32. DDEESSCCRRIIPPTTIIOONN
  33.      BBsseeaarrcchh searches bbaassee[[00]] ...... bbaassee[[nn -- 11]] for  an  item  that
  34.      matches  **kkeeyy.  The function ccmmpp must return negative if its
  35.      first argument (the search key) is less than its  second  (a
  36.      table entry), zero if equal, and positive if greater.  Items
  37.      in the array bbaassee  must  be  in  ascending  order.   bbsseeaarrcchh
  38.      returns a pointer to a matching item, or NNUULLLL if none exits.
  39.  
  40.  
  41. KKEEYYWWOORRDDSS
  42.      search
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65. Sprite v.1.0         Printed:  June 29, 1989                    1
  66.  
  67.  
  68.  
  69.